package top.system.dept.utils;

import java.io.IOException;
import java.io.InputStream;

/**
 * @ClassName: IOUtil
 * @Author: Amosen
 * @Since: 2021/5/23
 */
public class IOUtil {

    public static String readAsString(InputStream is) throws IOException {
        StringBuffer sb = new StringBuffer();
        byte[] buffer = new byte[1024];
        int i = is.read(buffer);
        while (i != -1) {
            sb.append(new String(buffer, 0, i));
            i = is.read(buffer);
        }
        is.close();
        return sb.toString();
    }

}
